package com.tailyou.hms.firstapp.act;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ListView;

import androidx.appcompat.app.AppCompatActivity;

import com.tailyou.hms.firstapp.R;
import com.tailyou.hms.firstapp.adapter.IndexAdapter;

import java.util.ArrayList;
import java.util.Arrays;

public class IndexActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_index);
        ArrayList<String> datas = new ArrayList<>(Arrays.asList(
                "登录界面",
                "我的界面",
                "文本控件",
                "图片控件",
                "选择控件",
                "进度控件",
                "音乐播放器",
                "生命周期",
                "参数传递",
                "ArrayAdapter",
                "BaseAdapter",
                "TabLayout",
                "Menu",
                "Dialog",
                "异步任务",
                "BroadcastReceiver",
                "数据库",
                "网络请求-HttpUrlConnection",
                "网络请求-OkHttp",
                "ContentProvider",
                "通知消息",
                "拍照相册",
                "Material Design",
                "Pagination Navigator",
                "CustomVideoView",
                "Menu&List",
                "欢迎页面"));
        ListView listView = findViewById(R.id.list);
        listView.setAdapter(new IndexAdapter(IndexActivity.this, datas) {
            @Override
            public void clickItem(int i) {
                switch (i) {
                    case 0:
                        startActivity(new Intent(IndexActivity.this, LoginActivity.class));
                        break;
                    case 1:
                        startActivity(new Intent(IndexActivity.this, MineActivity.class));
                        break;
                    case 2:
                        startActivity(new Intent(IndexActivity.this, TxtWdgActivity.class));
                        break;
                    case 3:
                        startActivity(new Intent(IndexActivity.this, ImgWdgActivity.class));
                        break;
                    case 4:
                        startActivity(new Intent(IndexActivity.this, SelWdgActivity.class));
                        break;
                    case 5:
                        startActivity(new Intent(IndexActivity.this, PrgWdgActivity.class));
                        break;
                    case 6:
                        startActivity(new Intent(IndexActivity.this, PlayerActivity.class));
                        break;
                    case 7:
                        startActivity(new Intent(IndexActivity.this, LifeActivity.class));
                        break;
                    case 8:
                        Intent intent = new Intent(IndexActivity.this, ParamsActivity.class);
                        intent.putExtra("msg", "我是主页面，启动参数传递界面");
                        startActivity(intent);
                        break;
                    case 9:
                        startActivity(new Intent(IndexActivity.this, ArrayAdapterActivity.class));
                        break;
                    case 10:
                        startActivity(new Intent(IndexActivity.this, BaseAdapterActivity.class));
                        break;
                    case 11:
                        startActivity(new Intent(IndexActivity.this, TabLayoutActivity.class));
                        break;
                    case 12:
                        startActivity(new Intent(IndexActivity.this, MenuActivity.class));
                        break;
                    case 13:
                        startActivity(new Intent(IndexActivity.this, DialogActivity.class));
                        break;
                    case 14:
                        startActivity(new Intent(IndexActivity.this, AsyncActivity.class));
                        break;
                    case 15:
                        startActivity(new Intent(IndexActivity.this, ReceiverActivity.class));
                        break;
                    case 16:
                        startActivity(new Intent(IndexActivity.this, SQLiteActivity.class));
                        break;
                    case 17:
                        startActivity(new Intent(IndexActivity.this, HttpUrlConnectionActivity.class));
                        break;
                    case 18:
                        startActivity(new Intent(IndexActivity.this, OkHttpActivity.class));
                        break;
                    case 19:
                        startActivity(new Intent(IndexActivity.this, ProviderActivity.class));
                        break;
                    case 20:
                        startActivity(new Intent(IndexActivity.this, NotificationActivity.class));
                        break;
                    case 21:
                        startActivity(new Intent(IndexActivity.this, CameraActivity.class));
                        break;
                    case 22:
                        startActivity(new Intent(IndexActivity.this, MaterialDesignActivity.class));
                        break;
                    case 23:
                        startActivity(new Intent(IndexActivity.this, PaginationNavigatorActivity.class));
                        break;
                    case 24:
                        startActivity(new Intent(IndexActivity.this, CustomVideoActivity.class));
                        break;
                    case 25:
                        startActivity(new Intent(IndexActivity.this, MenuListActivity.class));
                        break;
                    case 26:
                        startActivity(new Intent(IndexActivity.this, WelcomeActivity.class));
                        break;
                }
            }
        });
    }

}